import {login} from "@/utils/api/login"
import storage from "@/utils/storage"
export default {
    namespaced: true,
    state: {
        user:{
        }
    },
    getters: {
    },
    mutations: {
        addUser(state,obj){
            state.user=obj
        }
    },
    actions: {
       async setUser(commap,obj){  
           console.log(222);    
         return  login(obj).then(data=>new Promise((resolve,reject)=>{
               console.log(data);
            if(data.status==200){  
                let user={
                    id:1,
                    username:'王多鱼'
                }
                storage.setStorage('user',user)
               resolve('登陆成功')
               }else{
               reject('登录失败')
               }
           }))
        }
        
    }, 
}